package com.mark.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.Map;

/**
 * @author MARKCC
 * @date 2018/10/10-10:21
 * @email markerccc@163.com
 */
@Controller
public class HellController {

    // /**
    //  * 不让这个方法访问public文件夹下的index页面
    //  * @return
    //  */
    // @RequestMapping({"/", "/index.html"})
    // public String index(){
    //     return "index";
    // }

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "Hello World";
    }

    /**
     * 查出一些数据在页面展示
     * @return
     */
    @RequestMapping("/success")
    public String success(Map<String, Object> map){
        //classpath:/templates/success.html
        map.put("hello", "<h1>你好</h1>");
        map.put("users", Arrays.asList("zhangsan", "lisi", "wangwu"));
        return "success";
    }
}
